<template>
	<view>
		<view v-for='(item,index) in sexData' :key="index">
			<text>{{item.name}}</text> -----
			<text>{{item.sex | formSex }}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sexData: [{
						name: '测试',
						sex: '0'
					},
					{
						name: '测试',
						sex: '1'
					},
					{
						name: '测试',
						sex: '2'
					},
				],
				//过滤后存放数据
				list: [],
				//过滤前
				listData: [{
						'id': '0',
						'name': '测试',
						'image': '图片1'
					},
					{
						'id': '0',
						'name': '测试1',
						'image': '图片1'
					},
					{
						'id': '1',
						'name': '测试2',
						'image': '图片1'
					},
					{
						'id': '1',
						'name': '测试',
						'image': '图片1'
					},
				]
			}
		},
		components: {

		},
		onLoad() {
			console.log("原数据", this.listData);
			this.judge();
		},
		methods: {
			judge() {
				this.list = this.listData.filter((item, index) => {
					return item.id == 0;
					console.log(item);
				});
				console.log("过滤数据", this.list);
			}
		},
		filters: {
			formSex(set) {
				const status = {
					"0": "空白",
					"1": "男",
					"2": "女",
				}
				return status[set];
			}
		}
	}
</script>

<style>
	.order_top {
		display: flex;
		align-items: center;
		justify-content: space-around;
		background-color: #FFFFFF;
	}

	.swiper_tab_list {
		color: #888888;
		font-weight: bold;
	}

	.uni_tab_bar .active {
		color: #FEDE33;
		margin-top: 17rpx;
		background-color: #FFFFFF;
	}

	.active .swiper_tab_line {
		border-bottom: 4rpx solid #FEDE33;
		width: 50rpx;
		margin: auto;
		margin-top: 17rpx;
		background-color: #0B9C13;
	}

	.uni_swiper_tab {
		border-bottom: 2rpx solid #eeeeee;
		margin-bottom: 15rpx;
	}

	.order_centext {
		height: 800rpx;
		position: fixed;
		top: 200rpx;
		left: 0;
		right: 0;
		bottom: 0;
		/* background-color: #8A6DE9; */
		margin-left: 15rpx;
		margin-right: 15rpx;
	}
</style>
